Skip to content

Conversation

@pranaygp
Copy link
Collaborator

This commit extracts builder infrastructure from @workflow/cli into a new
shared @workflow/builders package. This improves code organization by:

  • Creating a dedicated package for builder functionality
  • Allowing @workflow/next and @workflow/nitro to depend on builders directly
  • Reducing coupling between framework integrations and the CLI
  • Preparing for moving NextBuilder to @workflow/next in the next PR

Changes:

  • Created new @workflow/builders package
  • Moved BaseBuilder, BasicBuilder, and VercelBuildOutputAPIBuilder
  • Moved esbuild plugins (swc, discover-entries, node-module)
  • Moved WorkflowConfig and BuildTarget types
  • Updated @workflow/cli to import from @workflow/builders
  • Updated @workflow/nitro to import from @workflow/builders
  • Re-exported types from CLI for backwards compatibility

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

@vercel
Copy link
Contributor

vercel bot commented Oct 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview Comment Nov 3, 2025 9:33pm
example-nextjs-workflow-webpack Ready Ready Preview Comment Nov 3, 2025 9:33pm
example-workflow Ready Ready Preview Comment Nov 3, 2025 9:33pm
workbench-nitro-workflow Ready Ready Preview Comment Nov 3, 2025 9:33pm
workbench-sveltekit-workflow Error Error Nov 3, 2025 9:33pm
workbench-vite-workflow Ready Ready Preview Comment Nov 3, 2025 9:33pm
workflow-docs Ready Ready Preview Comment Nov 3, 2025 9:33pm

@changeset-bot
Copy link

changeset-bot bot commented Oct 26, 2025

🦋 Changeset detected

Latest commit: 120a73d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@workflow/builders Patch
@workflow/cli Patch
@workflow/nitro Patch
@workflow/next Patch
workflow Patch
@workflow/world-testing Patch
@workflow/ai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

import { mkdir, writeFile } from 'node:fs/promises';
import { join, resolve } from 'node:path';
import { BaseBuilder } from './base-builder.js';
import { BaseBuilder } from '@workflow/builders';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be moving these builders over in future PRs

@@ -1,6 +1,6 @@
import { mkdir } from 'node:fs/promises';
import { dirname, resolve } from 'node:path';
import { BaseBuilder } from './base-builder.js';
import { BaseBuilder } from '@workflow/builders';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be moving these builders over in future PRs

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Build Fix:

The index.ts file was importing constants from a non-existent constants.js file, causing TypeScript compilation to fail.

View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..32a74a6 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,3 @@ export { applySwcTransform } from './apply-swc-transform.js';
 export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
 export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
 export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';

Analysis

Missing constants.js file causes TypeScript compilation failure

What fails: TypeScript compiler fails on packages/builders/src/index.ts at line 11 due to missing constants.js file

How to reproduce:

cd packages/builders && pnpm run build

Result:

src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Build Fix:

The constants.ts file was missing but required by index.ts for exporting STEP_QUEUE_TRIGGER and WORKFLOW_QUEUE_TRIGGER constants.

View Details
📝 Patch Details
diff --git a/packages/builders/src/constants.ts b/packages/builders/src/constants.ts
new file mode 100644
index 0000000..97e01ae
--- /dev/null
+++ b/packages/builders/src/constants.ts
@@ -0,0 +1,2 @@
+export const STEP_QUEUE_TRIGGER = 'step' as const;
+export const WORKFLOW_QUEUE_TRIGGER = 'workflow' as const;
\ No newline at end of file

Analysis

Missing constants file causes TypeScript compilation failure

What fails: TypeScript compiler fails on packages/builders/src/index.ts line 11 due to missing constants module

How to reproduce:

cd packages/builders && pnpm run build

Result:

src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Build Fix:

The file imports constants from a non-existent ./constants.js module, causing TypeScript compilation to fail.

View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..396d2cd 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,4 @@ export { applySwcTransform } from './apply-swc-transform.js';
 export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
 export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
 export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
+

Analysis

Missing constants.js module causes TypeScript compilation failure

What fails: TypeScript compiler fails on packages/builders/src/index.ts due to missing import of non-existent ./constants.js file

How to reproduce:

cd packages/builders && pnpm run build

Result:

src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Build Fix:

The file tried to import constants from a non-existent ./constants.js module, causing TypeScript compilation to fail. The unused export statement was removed since the constants weren't referenced anywhere in the codebase.

View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..396d2cd 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,4 @@ export { applySwcTransform } from './apply-swc-transform.js';
 export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
 export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
 export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
+

Analysis

Missing constants file causes TypeScript compilation failure

What fails: TypeScript compiler fails on packages/builders/src/index.ts line 11 due to import from non-existent ./constants.js module

How to reproduce:

cd packages/builders && npx tsc

Result:

src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Build Fix:

The TypeScript compiler failed because line 11 attempts to import STEP_QUEUE_TRIGGER and WORKFLOW_QUEUE_TRIGGER from a non-existent constants.js file. This import was added during the builders package creation but the constants file was never created.

View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..396d2cd 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,4 @@ export { applySwcTransform } from './apply-swc-transform.js';
 export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
 export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
 export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
+

Analysis

TypeScript compilation failure due to missing constants file

What fails: TypeScript compiler fails on packages/builders/src/index.ts line 11 due to import from non-existent './constants.js' file

How to reproduce:

cd packages/builders && pnpm run build

Result:

src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.

@pranaygp pranaygp force-pushed the pranaygp/create-workflow-builders-package branch from 736b61a to 738a512 Compare October 26, 2025 06:44
import { mkdir, readFile, writeFile } from 'node:fs/promises';
import { BaseBuilder } from '@workflow/cli/dist/lib/builders/base-builder';
import { VercelBuildOutputAPIBuilder } from '@workflow/cli/dist/lib/builders/vercel-build-output-api';
import { join } from 'node:path';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Build Fix:

The file has duplicate join imports from both node:path and pathe packages, causing TypeScript compilation to fail with duplicate identifier errors.

View Details
📝 Patch Details
diff --git a/packages/nitro/src/builders.ts b/packages/nitro/src/builders.ts
index 42f2d2d..f054ce8 100644
--- a/packages/nitro/src/builders.ts
+++ b/packages/nitro/src/builders.ts
@@ -1,5 +1,4 @@
 import { mkdir, readFile, writeFile } from 'node:fs/promises';
-import { join } from 'node:path';
 import { BaseBuilder, VercelBuildOutputAPIBuilder } from '@workflow/builders';
 import type { Nitro } from 'nitro/types';
 import { join, resolve } from 'pathe';

Analysis

Duplicate identifier 'join' causes TypeScript compilation failure

What fails: TypeScript compiler fails on packages/nitro/src/builders.ts due to duplicate imports of join identifier

How to reproduce:

cd packages/nitro && pnpm run build

Result:

src/builders.ts(2,10): error TS2300: Duplicate identifier 'join'.
src/builders.ts(5,10): error TS2300: Duplicate identifier 'join'.

The file had conflicting imports:

  • Line 2: import { join } from 'node:path';
  • Line 5: import { join, resolve } from 'pathe';

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Build Fix:

The file imports join from both node:path and pathe libraries, creating a duplicate identifier error that prevents TypeScript compilation from succeeding.

View Details
📝 Patch Details
diff --git a/packages/nitro/src/builders.ts b/packages/nitro/src/builders.ts
index 42f2d2d..f054ce8 100644
--- a/packages/nitro/src/builders.ts
+++ b/packages/nitro/src/builders.ts
@@ -1,5 +1,4 @@
 import { mkdir, readFile, writeFile } from 'node:fs/promises';
-import { join } from 'node:path';
 import { BaseBuilder, VercelBuildOutputAPIBuilder } from '@workflow/builders';
 import type { Nitro } from 'nitro/types';
 import { join, resolve } from 'pathe';

Analysis

Duplicate identifier 'join' causes TypeScript compilation failure

What fails: TypeScript compiler fails on packages/nitro/src/builders.ts due to duplicate imports of join function from both node:path and pathe libraries

How to reproduce:

cd packages/nitro && pnpm run build

Result:

src/builders.ts(2,10): error TS2300: Duplicate identifier 'join'.
src/builders.ts(5,10): error TS2300: Duplicate identifier 'join'.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Build Fix:

The file contains duplicate imports of the join function from both node:path and pathe, causing a TypeScript compilation error that prevents the build from completing.

View Details
📝 Patch Details
diff --git a/packages/nitro/src/builders.ts b/packages/nitro/src/builders.ts
index 42f2d2d..f054ce8 100644
--- a/packages/nitro/src/builders.ts
+++ b/packages/nitro/src/builders.ts
@@ -1,5 +1,4 @@
 import { mkdir, readFile, writeFile } from 'node:fs/promises';
-import { join } from 'node:path';
 import { BaseBuilder, VercelBuildOutputAPIBuilder } from '@workflow/builders';
 import type { Nitro } from 'nitro/types';
 import { join, resolve } from 'pathe';

Analysis

Duplicate import causes TypeScript compilation failure in @workflow/nitro

What fails: TypeScript compilation fails on packages/nitro/src/builders.ts due to duplicate identifier join

How to reproduce:

cd packages/nitro && pnpm build

Result:

src/builders.ts(2,10): error TS2300: Duplicate identifier 'join'.
src/builders.ts(5,10): error TS2300: Duplicate identifier 'join'.
ELIFECYCLE  Command failed with exit code 2.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Build Fix:

The join function is imported twice, once from node:path and once from pathe, causing TypeScript to report a duplicate identifier error.

View Details
📝 Patch Details
diff --git a/packages/nitro/src/builders.ts b/packages/nitro/src/builders.ts
index 42f2d2d..f054ce8 100644
--- a/packages/nitro/src/builders.ts
+++ b/packages/nitro/src/builders.ts
@@ -1,5 +1,4 @@
 import { mkdir, readFile, writeFile } from 'node:fs/promises';
-import { join } from 'node:path';
 import { BaseBuilder, VercelBuildOutputAPIBuilder } from '@workflow/builders';
 import type { Nitro } from 'nitro/types';
 import { join, resolve } from 'pathe';

Analysis

Duplicate identifier 'join' causes TypeScript compilation failure

What fails: TypeScript compiler fails on packages/nitro/src/builders.ts due to duplicate imports of the join function

How to reproduce:

cd packages/nitro && pnpm run build

Result:

src/builders.ts(2,10): error TS2300: Duplicate identifier 'join'.
src/builders.ts(5,10): error TS2300: Duplicate identifier 'join'.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"dependencies": {
"@swc/core": "1.11.24",
"@workflow/cli": "workspace:*",
"@workflow/swc-plugin": "workspace:*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate dependency declaration: @workflow/swc-plugin is listed twice in the dependencies object (lines 30 and 33).

View Details
📝 Patch Details
diff --git a/packages/nitro/package.json b/packages/nitro/package.json
index 619d285..0b19a61 100644
--- a/packages/nitro/package.json
+++ b/packages/nitro/package.json
@@ -30,7 +30,6 @@
     "@workflow/swc-plugin": "workspace:*",
     "@workflow/builders": "workspace:*",
     "@workflow/core": "workspace:*",
-    "@workflow/swc-plugin": "workspace:*",
     "exsolve": "^1.0.7",
     "pathe": "^2.0.3"
   },

Analysis

Duplicate dependency declaration in packages/nitro/package.json

What fails: The @workflow/swc-plugin dependency is declared twice in the dependencies object (lines 30 and 33), violating JSON semantics where duplicate keys result in undefined behavior.

How to reproduce:

# Parse and inspect the dependencies object
node -e "console.log(Object.keys(require('./packages/nitro/package.json').dependencies))"
# The duplicate key will appear only once due to silent overwrites

Result: While the JSON parser silently keeps only the last occurrence, this is undefined behavior and violates best practices for configuration files. Most JSON tools and linters will flag this as an error.

Expected: Each dependency should be declared exactly once in the dependencies object per JSON specification and npm package.json conventions.

Fix: Removed the duplicate "@workflow/swc-plugin": "workspace:*" entry on line 33.

import { mkdir, readFile, writeFile } from 'node:fs/promises';
import { BaseBuilder } from '@workflow/cli/dist/lib/builders/base-builder';
import { VercelBuildOutputAPIBuilder } from '@workflow/cli/dist/lib/builders/vercel-build-output-api';
import { join } from 'node:path';
Copy link
Contributor

@vercel vercel bot Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { join } from 'node:path';

Duplicate join import: join is imported from both node:path (line 2) and pathe (line 5), with the second import shadowing the first.

View Details

Analysis

Duplicate join import causes TypeScript compilation error in builders.ts

What fails: packages/nitro/src/builders.ts imports join from both node:path (line 2) and pathe (line 5), causing TypeScript error TS2300: Duplicate identifier 'join'. The second import shadows the first, making the node:path import unused.

How to reproduce:

cd packages/nitro
npx tsc --noEmit

Result: TypeScript reports:

src/builders.ts(2,10): error TS2300: Duplicate identifier 'join'.
src/builders.ts(5,10): error TS2300: Duplicate identifier 'join'.

Expected: TypeScript should compile without errors. The codebase intentionally uses pathe for path operations (it's declared as a dependency and also imported in packages/nitro/src/index.ts), so the unused node:path import should be removed.

Fix: Removed the duplicate import { join } from 'node:path'; from line 2, keeping only the import { join, resolve } from 'pathe'; import which is the intended import and is actually used throughout the file.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Build Fix:

The file contains duplicate imports of the join function from both 'node:path' and 'pathe' packages, causing a TypeScript compilation error.

View Details
📝 Patch Details
diff --git a/packages/nitro/src/builders.ts b/packages/nitro/src/builders.ts
index 42f2d2d..f054ce8 100644
--- a/packages/nitro/src/builders.ts
+++ b/packages/nitro/src/builders.ts
@@ -1,5 +1,4 @@
 import { mkdir, readFile, writeFile } from 'node:fs/promises';
-import { join } from 'node:path';
 import { BaseBuilder, VercelBuildOutputAPIBuilder } from '@workflow/builders';
 import type { Nitro } from 'nitro/types';
 import { join, resolve } from 'pathe';

Analysis

TypeScript build failure due to duplicate identifier 'join'

What fails: TypeScript compiler fails on packages/nitro/src/builders.ts due to duplicate import of identifier 'join'

How to reproduce:

pnpm --filter @workflow/nitro run build

Result:

src/builders.ts(2,10): error TS2300: Duplicate identifier 'join'.
src/builders.ts(5,10): error TS2300: Duplicate identifier 'join'.

The file had duplicate imports:

  • Line 2: import { join } from 'node:path';
  • Line 5: import { join, resolve } from 'pathe';

…cture

This commit extracts builder infrastructure from @workflow/cli into a new
shared @workflow/builders package. This improves code organization by:

- Creating a dedicated package for builder functionality
- Allowing @workflow/next and @workflow/nitro to depend on builders directly
- Reducing coupling between framework integrations and the CLI
- Preparing for moving NextBuilder to @workflow/next in the next PR

Changes:
- Created new @workflow/builders package
- Moved BaseBuilder, BasicBuilder, and VercelBuildOutputAPIBuilder
- Moved esbuild plugins (swc, discover-entries, node-module)
- Moved WorkflowConfig and BuildTarget types
- Updated @workflow/cli to import from @workflow/builders
- Updated @workflow/nitro to import from @workflow/builders
- Re-exported types from CLI for backwards compatibility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants